#ifndef GUMBALLMACHINE_H
#define GUMBALLMACHINE_H

#include "state.h"

class GumballMachine
{
public:
    GumballMachine(int count = 0);

public:
    void insertQuarter();
    void ejectQuarter();
    void turnCrank();
    void dispense();

    void setState(State *state);

    State *getNoQuarterState();
    State *getHasQuarterState();
    State *getSellingState();
    State *getSoldOutState();

    void releaseGumBall();
    int getCount();

private:
    int m_count;
    State *m_curState;

    State *m_noQuarter;
    State *m_hasQuarter;
    State *m_selling;
    State *m_soldOut;
};

#endif // GUMBALLMACHINE_H
